package com.wash.shoes.controller.mobile;


import com.ruoyi.common.core.domain.R;
import com.wash.shoes.entity.RegionDistributorPo;
import com.wash.shoes.service.RegionDistributorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ljg
 * @since 2024-10-11
 */
@Api(tags = {"移动端-分销用户配置"})
@RestController
@RequestMapping("/mobile-api/regionDistributor")
public class RegionDistributorMController {

    @Resource
    RegionDistributorService regionDistributorService;

    @GetMapping("/customerDistributor")
    @ApiOperation("获取用户的分销信息")
    public R<RegionDistributorPo> customerDistributor(String userId) {
        RegionDistributorPo regionDistributorPo = regionDistributorService.getByUserId(userId);
        // 如果禁用了就不存在分销信息
        if (regionDistributorPo != null && regionDistributorPo.getStatus() == 0) {
            return R.ok(null);
        }
        return R.ok(regionDistributorPo);
    }

}

